package com.ruoyi.wxarea.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.wxarea.service.IAddressInfoService;
import com.ruoyi.wxarea.mapper.AddressInfoMapper;
import com.ruoyi.wxarea.pojo.AddressInfo;
import com.ruoyi.wxcommon.common.Result;
import org.springframework.stereotype.Service;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 凡哥哥
 * @since 2024-05-10
 */
@Service
public class AddressInfoServiceImpl extends ServiceImpl<AddressInfoMapper, AddressInfo> implements IAddressInfoService {

    @Override
    public Result addressInfoDetailAddress(Integer pageIndex, Integer pageSize, Integer cateId, Integer aId) {
        Page<AddressInfo> page = new Page<>(pageIndex,pageSize);
        LambdaQueryWrapper<AddressInfo> lqw = new LambdaQueryWrapper<>();
        lqw.eq(AddressInfo::getIsDelete,1).eq(AddressInfo::getIsDelete,1).eq(AddressInfo::getAId,aId).eq(AddressInfo::getCateId,cateId);
        lqw.orderByAsc(AddressInfo::getSort);
        Page<AddressInfo> page1 = this.page(page, lqw);
        return Result.SUCCESS(page1);
    }
}
